home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / trem.zip / CURSOR.C < prev    next >
Text File  |  1991-05-11  |  2KB  |  59 lines

  1. /************************************************************************
  2.  *
  3.  *    Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *-----------------------------------------------------------------------
  6.  *
  7.  *     Project:  Windows Terminal Example
  8.  *
  9.  *      Module:  cursor.c
  10.  *
  11.  *      Author:  Bryan A. Woodruff (baw)
  12.  *
  13.  *
  14.  *     Remarks:  This function controls caret movement.
  15.  *
  16.  *   Revisions:  
  17.  *     01.00.000  5/ 9/91 baw   Wrote it.
  18.  *
  19.  ************************************************************************/
  20.  
  21. #include "terminal.h"
  22.  
  23. /************************************************************************
  24.  *  BOOL MoveTerminalCursor( HWND hWnd )
  25.  *
  26.  *  Description:
  27.  *     Moves caret to current position.
  28.  *
  29.  *  Comments:
  30.  *     5/ 9/91  baw  Wrote it.
  31.  *
  32.  ************************************************************************/
  33.  
  34. BOOL MoveTerminalCursor( HWND hWnd )
  35. {
  36.    LOCALHANDLE  hTermInfo ;
  37.    NPTERMINFO   npTermInfo ;
  38.  
  39.    hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
  40.    if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
  41.       return ( FALSE ) ;
  42.  
  43.  
  44.    if (npTermInfo -> fConnected && (npTermInfo -> wCursorState & CS_SHOW))
  45.       SetCaretPos( (npTermInfo -> nColumn * npTermInfo -> xChar) -
  46.                    npTermInfo -> xOffset,
  47.                    (npTermInfo -> nRow * npTermInfo -> yChar) -
  48.                    npTermInfo -> yOffset ) ;
  49.    
  50.    LocalUnlock( hTermInfo ) ;
  51.    return ( TRUE ) ;
  52.  
  53. } /* end of MoveTerminalCursor() */
  54.  
  55. /************************************************************************
  56.  * End of File: cursor.c
  57.  ************************************************************************/
  58.  
  59.